package com.example.excelimporter.service.impl;

import com.example.excelimporter.service.DictionaryService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class DictionaryServiceImpl implements DictionaryService {

    private final Map<String, Map<String, String>> dictionaryCache = new HashMap<>();

    @Override
    public String getMappedValue(String dictionaryCode, String originalValue) {
        Map<String, String> dictionary = dictionaryCache.get(dictionaryCode);
        if (dictionary != null) {
            return dictionary.get(originalValue);
        }
        return null;
    }

    @Override
    public void reloadDictionary(String dictionaryCode) {
        // TODO: 实现字典重新加载逻辑
        // 可以从数据库或其他数据源重新加载字典
    }
}
